<?php
/**
 * User: itimphp
 * Date: 6/6/12
 * Time: 9:56 PM
 */
require_once 'bootstrap.php';
$multichoice = Service_Value::get_multilchoice(3);
?>

<head xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
	<link href="css/bootstrap.css" type="text/css" rel="stylesheet">
	<link href="css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.js"></script>
	<script type="text/javascript" src="js/bootstrap.datetimepicker.js"></script>
	<title>Loan form - Form 1</title>
</head>
<html>
<body>
<body style="background-color:#000;">
<script type="text/javascript">
	var RecaptchaOptions = {
		theme:'white'
	};
</script>

<div style="background-color:#E9E9E9; width: 700px; margin-left: auto; margin-right: auto;">
	<h2>Apply for a Secured Loan:</h2><br>

	<form class="form-inline form-horizontal" method="POST" action="form3.php" onsubmit="return validate();"
	      id="form3">
		<div class="control-group">
			<label class="control-label" for="amount">Amount</label>

			<div class="controls">
				<input type="text" id="amount" name="amount" class="span3 require" maxlength="15">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="purpose">Purpose</label>

			<div class="controls">
				<select name="purpose" id="purpose" class="require">
					<?php foreach ($multichoice['purpose'] as $key => $value): ?>
					<option value="<?= $key ?>"><?= $value ?></option>
					<?php endforeach;?>
				</select>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="title">Title</label>

			<div class="controls">
				<select name="title" id="title" class="require">
					<?php foreach ($multichoice['title'] as $key => $value): ?>
					<option value="<?= $key ?>"><?= $value ?></option>
					<?php endforeach;?>
				</select>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="first_name">First name</label>

			<div class="controls">
				<input type="text" id="first_name" name="first_name" class="span3 require" maxlength="255">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="last_name">Surname</label>

			<div class="controls">
				<input type="text" id="last_name" name="last_name" class="span3 require" maxlength="255">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">Date of birth</label>

			<div class="controls">
				<select name="birth_date_day" id="birth_date_day" class="require">
					<option value="">Day...</option>
					<?php for ($i = 1; $i <= 31; $i++): ?>
					<option value="<?= $i ?>"><? echo $i;?></option>
					<?php endfor;?>
				</select>
				<select name="birth_date_month" id="birth_date_month" class="require">
					<option value="">Month...</option>
					<?php for ($i = 1; $i <= 12; $i++): ?>
					<option value="<?= $i ?>"><? echo $i;?></option>
					<?php endfor;?>
				</select>
				<select name="birth_date_year" id="birth_date_year" class="require">
					<option value="">Year...</option>
					<?php for ($i = 2012; $i > 1940; $i--): ?>
					<option value="<?= $i ?>"><? echo $i;?></option>
					<?php endfor;?>
				</select>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="home_phone">Home Tel No</label>

			<div class="controls">
				<input type="text" id="home_phone" name="home_phone" class="span3 require">
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="mobile_phone">Mobile Tel</label>

			<div class="controls">
				<input type="text" id="mobile_phone" name="mobile_phone" class="span3 require">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="married_status">Your status</label>

			<div class="controls">
				<select name="married_status" id="married_status" class="require">
					<?php foreach ($multichoice['married_status'] as $key => $value): ?>
					<option value="<?= $key ?>"><?= $value ?></option>
					<?php endforeach;?>
				</select>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">House Number</label>

			<div class="controls">
				<input type="text" id="house_number" name="house_number" class="span3 require" maxlength="255">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">or House Name</label>

			<div class="controls">
				<input type="text" id="house_name" name="house_name" class="span3 require" maxlength="255">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="postcode">Post code</label>

			<div class="controls">
				<input type="text" id="postcode" name="postcode" class="span3 require" maxlength="255">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="employment_type">Employment Type</label>

			<div class="controls">
				<select name="income_type" id="employment_type" class="require">
					<?php foreach ($multichoice['employment_type'] as $key => $value): ?>
					<option value="<?= $key ?>"><?= $value ?></option>
					<?php endforeach;?>
				</select>
			</div>
		</div>

		<div class="control-group">
			<label class="control-label" for="monthly_income">Monthly Income</label>

			<div class="controls">
				<input type="text" id="monthly_income" name="monthly_income" class="span3 require">
			</div>
		</div>

		<div class="control-group">
			<label class="control-label">Type the words</label>

			<div class="controls">
				<?php
				$publickey = '6LdkS9ISAAAAAAiOzrgYDSbCgcd9Fw4rutkulGQq'; // you got this from the signup page
				echo recaptcha_get_html($publickey);
				?>
			</div>
		</div>

		<div class="control-group">
			<div class="controls">
				<input type="submit" value="Submit">
			</div>
		</div>
	</form>
</div>
</body>

<script type="text/javascript">
	function validate() {
		var ok = true;
		$(".require").each(function () {
			if ($(this).val() == "") {
				$(this).parent().parent().addClass("error");
				ok = false;
			} else {
				$(this).parent().parent().removeClass("error");
			}
		});
		if (!ok) {
			$(".alert-error").remove();
			$("#form3").prepend('<div class="alert alert-error">Please fill full information</div>');
		} else {
			$(".alert-error").remove();
		}
		return ok;
	}
</script>
</html>